﻿package com.sos.ui
{ 
	import com.deadreckoned.assetmanager.AssetManager;
	import com.sos.core.game.GameMod;
	import com.sos.core.game.GamePlayerCard;
	import com.sos.core.game.GameStatus;
	import com.sos.core.Position;
	import com.sos.logging.Logger;
	import fl.transitions.*;
	import fl.transitions.easing.*;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.filters.*;
	import flash.geom.Matrix;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
    public class PlayerClip extends MovieClip 
    { 
		// -------------------------------------------------------------------------------
		// CONSTANTS
		// -------------------------------------------------------------------------------
		
		protected static const 		POSITIVE_MOD_COLOR:uint		= 0x0FA354;
		protected static const 		NEGATIVE_MOD_COLOR:uint		= 0xF21D39;
		protected static const 		BASE_STAT_COLOR:uint		= 0x000000;
		
		
		
		// -------------------------------------------------------------------------------
		// FIELDS
		// -------------------------------------------------------------------------------
		
		public var position:String;
		public var instanceId:String;
		public var side:String;
		public var playerName:String;
		public var img:MovieClip;
		public var active:Number;
		public var stayUp:Boolean;
		public var ballOwner:Boolean;
		public var rolloverEnabled:Boolean = true;
		public var effectBox:EffectBox;
		public var skill:uint;
		
		var loader = new Loader();
		//var loader:Bitmap;
		var loaderLarge = new Loader();
		var baseHeight = 154;
		var baseWidth = 97;
		
		var blurFilter = new BlurFilter(3, 3);
		var greyOutFilter = new ColorMatrixFilter([0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0]);
		var activeFilter = new GlowFilter(0xFFFFFF, .75, 20, 20, 2, 2, false, false);
		var oppFilter = new GlowFilter(0xFF0000, .75, 15, 15, 2, 2, false, false);
		var lowStamFilter = new GlowFilter(0xFF0000, .75, 20, 20, 2, 2, true, false);
		var dropFilter:BitmapFilter;
		
		var lgTxtArray:Array = new Array();
		var smallTxtArray:Array = new Array();
		
		public var isTargeting = false;
		public var isSubbingIn = false;
		public var targetMode = false;
		public var isValidTarget = false;
		public var targetId:String;
		public var ignoreLeftClick = false;
		private var isLockedForSolvePhase = false;
		private var isZoomedIn = false;
		
		public var playArea:PlayArea;
		
		public var gamePlayer:GamePlayerCard;
		
		public var gameDie:Die_White;
		public var score:int;
		public var scoreBox:TextField;
		
        public function PlayerClip(plData:GamePlayerCard, side:String, playArea:PlayArea) {
			Logger.debug("UI > PlayerClip > Instancing PlayerClip for " + plData.name + " ( " + side + ")");
			this.playArea = playArea;
			gamePlayer = plData;
			name = gamePlayer.name + "_BOX";
			
			skill = plData.skill;
			position = gamePlayer.position.sign;
			this.side = side;
			playerName = gamePlayer.name;
			instanceId = gamePlayer.instanceId.toString();
			pNameBox.htmlText = gamePlayer.skill.toString() + "- " + playerName;
			lgItems.lg_pNameBox.htmlText = gamePlayer.skill.toString() + "- " + playerName;
			if (gamePlayer.actionText)
				lgItems.actionText.text = gamePlayer.actionText;
			lgItems.lg_RoleBox.text = gamePlayer.role.sign.toUpperCase();
			RoleBox.text = gamePlayer.role.sign.toUpperCase();
			
			scoreBox = new TextField();
			scoreBox.multiline = true;
			scoreBox.width = 80;
			scoreBox.height = 80;
			scoreBox.transform.matrix = new Matrix(1, 0, 0, 1, -40, -30);
			var outline:GlowFilter=new GlowFilter(0x000000,1.0,2.0,2.0,10);
			outline.quality = BitmapFilterQuality.MEDIUM;
			scoreBox.filters=[outline];
			
			scoreBox.defaultTextFormat = getScoreTextFormat();
			
			blankBase.visible = false;
			oppBorder.visible = false;
			largeBlank.visible = false;
			stayUp = false;
			
			addEffectBox();
			
			lgTxtArray[0] = lgItems;
			
			smallTxtArray[0] = pNameBox;
			smallTxtArray[1] = RoleBox;
			smallTxtArray[2] = DriBox;
			smallTxtArray[3] = PasBox;
			smallTxtArray[4] = ScoBox;
			smallTxtArray[5] = DefBox;
			smallTxtArray[6] = StaBox;
			
			
			
			//SET LARGE VERSION INVISIBLE
			for (var i = 0; i < lgTxtArray.length; i++)
			{
				lgTxtArray[i].visible = false;
			}
			
			if (gamePlayer.role.sign == "gk")
			{
				lgItems.iconBar.visible = false;
				smallIconBar.visible = false;
			}
			else
			{
				lgItems.iconBarGk.visible = false;
				smallIconBarGk.visible = false;
			}
			
			loadStatValues();
			
			
			
			// FETCHING PLAYER IMAGES
			var assetManager:AssetManager = AssetManager.getInstance();
			
			
			var bmd:BitmapData = assetManager.get("s_" + gamePlayer.image).asset;
			loader = new Bitmap(bmd);
			loader.name = 'smallImage';
			addChildAt(loader, 1);
			
			loader.x=-loader.width/2;
			loader.y=-loader.height/2;
			
			bmd = assetManager.get(gamePlayer.image).asset;
			loaderLarge = new Bitmap(bmd);
			loaderLarge.name = 'largeImage';
			
			loaderLarge.x=-loaderLarge.width/2;
			loaderLarge.y=-loaderLarge.height/2;
			dropFilter = this.getDropShadowFilter();
			loaderLarge.filters = [dropFilter];
			
			scoreBox.visible = false;
			//Logger.debug('UI > PlayArea > Field > PlayerClip > Creating PlayerClip for: ' + playerName + ' SIDE: ' + side + ' POSITION : ' + position);
		}
		
		public function init() {
			// ADDING MOUSE LISTENERS
			this.addEventListener(MouseEvent.ROLL_OVER,handleMouseListeners,false,0,true);
			this.addEventListener(MouseEvent.ROLL_OUT,handleMouseListeners,false,0,true);
			this.addEventListener(MouseEvent.CLICK, handleMouseListeners, false, 0, true);
		}
		
		public function loadStatValues() {
			if (gamePlayer.role.sign == "gk")
			{
				setStatValue(gamePlayer.gameStats.goalkeeping, gamePlayer.modStats.goalkeeping, lgItems.lg_StaBox, StaBox);
			}
			else if (gamePlayer.position.isSubstitution) {
				setStatValue(gamePlayer.stats.dribiling, 0, lgItems.lg_DriBox, DriBox);
				setStatValue(gamePlayer.stats.passing, 0, lgItems.lg_PasBox, PasBox);
				setStatValue(gamePlayer.stats.scoring, 0, lgItems.lg_ScoBox, ScoBox);
				setStatValue(gamePlayer.stats.defence, 0, lgItems.lg_DefBox, DefBox);
				setStatValue(gamePlayer.stats.stamina, 0, lgItems.lg_StaBox, StaBox);
				
			}
			else
			{
				setStatValue(gamePlayer.gameStats.dribiling, gamePlayer.modStats.dribiling, lgItems.lg_DriBox, DriBox);
				setStatValue(gamePlayer.gameStats.passing, gamePlayer.modStats.passing, lgItems.lg_PasBox, PasBox);
				setStatValue(gamePlayer.gameStats.scoring, gamePlayer.modStats.scoring, lgItems.lg_ScoBox, ScoBox);
				setStatValue(gamePlayer.gameStats.defence, gamePlayer.modStats.defence, lgItems.lg_DefBox, DefBox);
				setStatValue(gamePlayer.gameStats.stamina, gamePlayer.modStats.stamina, lgItems.lg_StaBox, StaBox);
			}
		}
		
		private function setStatValue(value:int, modValue:int, largeBox:TextField, smallBox:TextField) {
			var color:uint;
			if (modValue > 0)
				color = POSITIVE_MOD_COLOR;
			else if (modValue < 0)
				color = NEGATIVE_MOD_COLOR;
			else	
				color = BASE_STAT_COLOR;
			largeBox.textColor = color;
			largeBox.text = value.toString();
			
			smallBox.textColor = color;
			smallBox.text = value.toString();
		}
		
		private function getBoxes(stat:String):Vector.<TextField> {
			var boxList:Vector.<TextField> = new Vector.<TextField>;
			switch (stat) {
				case 'dribbling':
					boxList.push(lgItems.lg_DriBox);
					boxList.push(DriBox);
					break;
				case 'passing':
					boxList.push(lgItems.lg_PasBox);
					boxList.push(PasBox);
					break;
				case 'defense':
					boxList.push(lgItems.lg_DefBox);
					boxList.push(DefBox);
					break;
				case 'scoring':
					boxList.push(lgItems.lg_ScoBox);
					boxList.push(ScoBox);
					break;
				case 'stamina':
					boxList.push(lgItems.lg_StaBox);
					boxList.push(StaBox);
					break;
				case 'goalkeeping':
					boxList.push(lgItems.lg_StaBox);
					boxList.push(StaBox);
					break;
					
			}
			return boxList;
		}
		
		public function addAnimatedStatValue(modValue:int, stat:String) {
			//Logger.debug('UI > PlayerClip > Floating mod ' + modValue.toString() + " to " + stat + " on player " + this.playerName);
			var boxes:Vector.<TextField> = new Vector.<TextField>;
			boxes = getBoxes(stat);
			var color:uint;
			if (modValue > 0)
				color = POSITIVE_MOD_COLOR;
			else if (modValue < 0)
				color = NEGATIVE_MOD_COLOR;
			
			var floater:FloatingText = new FloatingText(modValue, color);
			
			if (isLockedForSolvePhase) {
				lgItems.addChild(floater);
				floater.x = boxes[0].x + 5;
				floater.y = boxes[0].y - 10;
				
			}
			else {
				addChild(floater);
				floater.x = boxes[1].x + 5;
				floater.y = boxes[1].y - 10;
			}
			
			var tm:TransitionManager = new TransitionManager(floater);
			tm.startTransition( { type:Fly, direction:Transition.OUT, duration:5, easing:Strong.easeOut, startPoint:2 } );
			tm.startTransition( { type:Fade, direction:Transition.OUT, duration:5, easing:Regular.easeOut } );
			tm.addEventListener("allTransitionsOutDone", doneTrans, false, 0, true);
			var statValue:uint = uint(boxes[0].text) + modValue;
			setStatValue(statValue, modValue, boxes[0], boxes[1]);
		}
		
		public function doneTrans(e:Event):void {
			//trace('Transition Out Complete');
			MovieClip(e.target.content).parent.removeChild(MovieClip(e.target.content));
		}
		
		
		public function initMods() {
			var modList:Vector.<GameMod> = gamePlayer.mods;
			var mod:GameMod;
			var effect:Effect;
			for each (mod in modList) {
				//Logger.debug("UI > PlayerClip > Adding mod to " + playerName + ": " + mod.name + "(" + mod.id + " / " + mod.instanceId + ")");
				effect = new Effect(mod, this.instanceId);
				playArea.addEffect(effect);
			}
		}
		
		public function rollDie(dieValue:uint) {
			gameDie = new Die_White();
			gameDie.roll(dieValue);
			addChild(gameDie);
		}
		
		public function hideDie() {
			if (gameDie) {
				removeChild(gameDie);
				gameDie = null;
			}
		}
		
		public function getScoreTextFormat(color:uint = 0xFF0000, size:uint = 40):TextFormat {
			var format:TextFormat=new TextFormat();
			format.color = color;
			format.align = "center";
			format.size = size;
			
			return format;
		}
		
		public function showScore(score:int, isWinner:Boolean = false) {
			//Logger.debug('UI > PlayerClip > Showing score ' + score.toString() + " on player " + this.playerName);
			
			var scoreText:String = '';
			var statusText:String;
			var color:uint;
			
			if (score != 0)
				scoreText = score.toString() + "\n";
			
			
			if (isWinner) {
				statusText = "WIN";
				color = 0x00CC00;
			}
			else {
				statusText = "LOSE";
				color = 0xFF6600;
			}
			
			scoreBox.defaultTextFormat = getScoreTextFormat(color);
			scoreBox.text = scoreText;
			scoreBox.defaultTextFormat = getScoreTextFormat(color, 20);
			scoreBox.appendText(statusText);
			//Logger.debug('UI > PlayerClip > Showing score text ' + scoreBox.text + " on player " + this.playerName);
			
			this.score = score;
			//scoreBox.text = score.toString();
			scoreBox.visible = true;
			addChild(scoreBox);
		}
		
		public function hideScore() {
			//Logger.debug("UI > PlayerClip > Hiding score  on player " + this.playerName);
			if (scoreBox.visible == true) {
				scoreBox.visible = false;
				removeChild(scoreBox);
			}
		}
		
		public function update() {
			//Logger.debug("UI > PlayerClip > Updating " + gamePlayer.name);
			loadStatValues();
			var modList:Vector.<GameMod> = gamePlayer.mods;
			var mod:GameMod;
			var effect:Effect;
			/*
			for (var effectId in effectBox.effectList) {
				Logger.debug("UI > PlayerClip > " + playerName + " previous mods: " + effectBox.effectList[effectId].effectName + "(" + effectId + ")");
			}
			*/
			for (var effectId in effectBox.effectList) {
				playArea.removeEffectFromPlayer(effectId, this.instanceId);
				//effectBox.removeEffect(effectId);
			}
			
			effectBox.clearIcons();
			effectBox.redrawIcons();
			
			for each (mod in modList) {
				effect = new Effect(mod, this.instanceId);
				playArea.addEffect(effect);
			}
			//Logger.debug("UI > PlayerClip > Player " + playerName + " updated");
		}
			
		public function handleMouseListeners(e:MouseEvent) {
			//trace(e.type);
			switch (e.type) {
				case "rollOver":
					zoomIn(e);
					break;
				case "rollOut":
					zoomOut(e);
					break;	
				case "click":
					handleLeftClick(e);
					break;	
			}
		}
		
		public function addEffectBox():void {
			effectBox = new EffectBox(this);
			
			addChildAt(effectBox, 11);
			//trace(playerName + " now has an Effect Box");
		}
		
		
		public function setAsActive():void {
			loader.filters = [activeFilter];
			this.active = 1;
		}
		
		public function unsetAsActive():void {
			loader.filters = [];
			this.active = 0;
		}
		
		public function setAsBallHandler(ball:Ball):void {
			//this.ball.visible = true;
			this.ballOwner = true;
			if (side == 'away')
				ball.x = 47;
			else
				ball.x = -47;
			addChildAt(ball, 3);
		}
		
		public function unsetAsBallHandler():void {
			//this.ball.visible = false;
			this.ballOwner = false;
			
			//removeChild(playArea.ball);
		}
		
		function setSideGlow():void {
			//trace("SETTING SIDE GLOW");
			var color: uint;;
			if (playArea.fieldMc.clientSide == side)
			{
				color = 0xFFFFFF;
			}
			else {
				color = 0xCC0000;
				oppBorder.visible = true;
				setChildIndex(oppBorder, 2);
			}
			
			
		}
		
		function enterTargetMode(isValidTarget:Boolean) {
			
			targetMode = true;
			
			if (isValidTarget == true) {
				this.buttonMode = true;
				this.useHandCursor = true;
				this.isValidTarget = true;
			}
			else {
				filters = [this.greyOutFilter, this.blurFilter];
			}
			
		}
		
		function exitTargetMode() {
			if (isValidTarget == true) {
				this.buttonMode = false;
				this.useHandCursor = false;
			}
			targetMode = false;
			isValidTarget = false;
			if (isSubbingIn)
				filters = [activeFilter];
			else 
				filters = [];
		}
		
		function handleLeftClick(e:MouseEvent):void {
			
			if (gamePlayer.position.isSubstitution) {
				if (isSubbingIn) {
					isSubbingIn = false;
					playArea.unQueueSub(playArea.fieldMc.playerList[targetId]);
					playArea.stopHighlightingPlayer(playArea.fieldMc.playerList[targetId]);
					targetId = null;
					filters = [];
					zoomOut(e);
				}
				else if (isTargeting) {
					playArea.exitTargetMode();
					isTargeting = false;
					stayUp = false;
					playArea.targetingCardId = '';
				}
				else {
					var validTargets:Array = new Array();
					
					switch (position) {
						case 'sub_df':
							validTargets.push(playArea.fieldMc.getPlayerAtPos('d1', playArea.clientSide).instanceId);
							validTargets.push(playArea.fieldMc.getPlayerAtPos('d2', playArea.clientSide).instanceId);
							break;
						case 'sub_mf':
							validTargets.push(playArea.fieldMc.getPlayerAtPos('mf', playArea.clientSide).instanceId);
							break;
						case 'sub_fw':
							validTargets.push(playArea.fieldMc.getPlayerAtPos('f1', playArea.clientSide).instanceId);
							validTargets.push(playArea.fieldMc.getPlayerAtPos('f2', playArea.clientSide).instanceId);
							break;
					}
					
					if (playArea.subCounter >= playArea.maxSubstitutions) //CARD LIMIT REACHED
					{
						trace("SUB LIMIT REACHED (" + playArea.maxSubstitutions + ")");
					}
					else
					{
						trace("ENTERING SUB SELECTION MODE ", validTargets);
						isTargeting = true;
						stayUp = true;
						playArea.targetingCardId = instanceId;
						playArea.playMenu.setTargetingMessage("Select player to sub out");
						playArea.enterTargetMode(validTargets, instanceId);
					}
				}
			}
			else if (ignoreLeftClick == false) {
				trace("HANDLING LEFT CLICK ON ", this.playerName);
				if (targetMode == false)
					toggleStayUp(e);
				else if (isValidTarget == true)
				{
					if (playArea.targetingCardId == 'roundAction') {
						playArea.setRoundActionTarget(this);
						
						trace("ACTION TARGET IS " + playerName + " IN POS " + position);
					}
					else if (playArea.engine.game.status == GameStatus.SUBSTITUTION) {
						Logger.debug("UI > PLAYERCARD > Subbing out " + playerName);
						playArea.fieldMc.playerList[playArea.targetingCardId].setTarget(instanceId);
					}
					else if (playArea.targetingCardId != '') {
						trace(playerName + " TARGETED");
						playArea.handCardList[playArea.targetingCardId].setTarget(instanceId);
						
					}
					else {
						
					}
				}
			}
			else {
				trace("IGNORING LEFT CLICK ON ", this.playerName);
			}
				
			
		}
		
		function setTarget(id:String):void {
			targetId = id;
			playArea.exitTargetMode();
			playArea.queueSub(playArea.fieldMc.playerList[targetId]);
			isSubbingIn = true;
			filters = [activeFilter];
			var e:MouseEvent = new MouseEvent("click");
			stayUp = false;
			isTargeting = false;
			zoomOut(e);
			
		}
		
		
		function lockUpForSolvePhase():void {
			if (!isLockedForSolvePhase) {
				var e:MouseEvent = new MouseEvent("click");
				ignoreLeftClick = true;
				zoomIn(e);
				stayUp = true;
				isLockedForSolvePhase = true;
			}
		}
		
		function unlockFromSolvePhase():void {
			
			if (isLockedForSolvePhase) {
				var e:MouseEvent = new MouseEvent("click");
				stayUp = false;
				zoomOut(e);
				ignoreLeftClick = false;
				isLockedForSolvePhase =  false;
			}
			
		}
		
		function toggleStayUp(e:MouseEvent):void {
			if (stayUp == true)
			{
				stayUp = false;
				zoomOut(e);
			}
			else
			{
				stayUp = true;
				zoomIn(e);
			}
		}
		
		function addFilter(filter:BitmapFilter) {
			var tmpArr = filters;
			tmpArr.push(filter);
			filters = tmpArr;
		}
		
		function setLargeImgPosition():void {
			
			var xDiff:Number = 0;
			var yDiff:Number = 0;
			
			if (this.side == 'home') 
				xDiff = (position == 'gk') ? 30 : -30;
			else 
				xDiff = (position != 'gk') ? 30 : -30;
			
			if ((position == 'f1')||(position == 'd1'))
				yDiff = 43;
			else if ((position == 'f2')||(position == 'd2'))
				yDiff = -43;
			
			loaderLarge.x = -loaderLarge.width/2 + xDiff;
			loaderLarge.y = -loaderLarge.height/2 + yDiff;
			
			lgItems.x = lgItems.x + xDiff;
			lgItems.y = lgItems.y + yDiff;
			
			effectBox.x += xDiff;
			effectBox.y += yDiff;
			
		}
		
		function resetLargeImgPosition():void {
			
			lgItems.x = 0;
			lgItems.y = 0.35;
			
			loaderLarge.x=-loaderLarge.width/2;
			loaderLarge.y=-loaderLarge.height/2;
			
			effectBox.x = 0;
			effectBox.y = 0;
			
		}
		
		function zoomIn(e:MouseEvent):void{
			//trace("ENTERING " + e.target.name + " FROM " + playerName);
			
			//if ((rolloverEnabled == true)&&(e.target.name != 'largeImage')&&(stayUp == false))
			if ((rolloverEnabled == true)&&(stayUp == false)&&(isZoomedIn === false))
			//if (rolloverEnabled == true)
			{
				//trace("ENTERING " + e.target.name);
				try {
					//this.removeChild(loader);
					loader.visible = false;
				}
				catch(er:ArgumentError) {
					//trace("Error caught while zooming In");
				}
				
				var n:uint = this.lgTxtArray.length;
				var i:uint = 0;
				
				for (i = 0; i < n; i++)
				{
					this.lgTxtArray[i].visible = true;
				}
				
				n = this.smallTxtArray.length;
				for (i = 0; i < n; i++)
				{
					this.smallTxtArray[i].visible = false;
				}
				addChildAt(loaderLarge, 10);
				setLargeImgPosition();
				
				this.effectBox.effectDescBoxLarge.visible = true;
				this.effectBox.effectDescBoxSmall.visible = false;
				
				
				if (this.oppBorder.visible == true)
					this.oppBorder.visible = false;
				isZoomedIn = true;
			}
			//playArea.fieldMc.addChild(this.parent);
			playArea.fieldMc.addChild(this);
			
		}
		
		function zoomOut(e:MouseEvent):void{
			//trace("EXITING " + e.target.name + " FROM " + playerName);
			if ((rolloverEnabled == true)&&(stayUp == false)&&(isZoomedIn === true))
			{
				resetLargeImgPosition();
				//trace("EXITING " + e.target.name);
				try {
					this.removeChild(loaderLarge);
				}
				catch(er:ArgumentError) {
					//trace("Error caught while zooming Out");
				}
				
				var n:uint = this.lgTxtArray.length;
				var i:uint = 0;
				
				for (i = 0; i < n; i++)
				{
					this.lgTxtArray[i].visible = false;
				}
				
				n = this.smallTxtArray.length;
				for (i = 0; i < n; i++)
				{
					this.smallTxtArray[i].visible = true;
				}
				
				
				this.effectBox.effectDescBoxLarge.visible = false;
				this.effectBox.effectDescBoxSmall.visible = true;
				if (playArea.fieldMc.clientSide != side)
					oppBorder.visible = true;
				loader.visible = true;
				//addChildAt(loader, 1);
				//playArea.fieldMc.setChildIndex(this.parent, 1);
				playArea.fieldMc.setChildIndex(this, 1);
				
				isZoomedIn = false;
			}
			playArea.restoreFrontObjects();
		}
		
		public function moveTo(pos:String) {
			this.position = pos;
			
			if (Position.getBySign(pos).isSubstitution) {
				visible = false;
				
			}
		}
		
		public function dispose():void {
			Logger.debug("UI > PlayerClip > Disposing of " + this.playerName);
			effectBox = null;
		}
		
		public function printStatus() {
			//trace('CURRENT POSITION: ' + position);
		}
		
		private function getDropShadowFilter(color:Number = 0x000000):BitmapFilter {
            
            var angle:Number = 45;
            var alpha:Number = 0.8;
            var blurX:Number = 8;
            var blurY:Number = 8;
            var distance:Number = 15;
            var strength:Number = 0.65;
            var inner:Boolean = false;
            var knockout:Boolean = false;
            var quality:Number = BitmapFilterQuality.HIGH;
            return new DropShadowFilter(distance,
                                        angle,
                                        color,
                                        alpha,
                                        blurX,
                                        blurY,
                                        strength,
                                        quality,
                                        inner,
                                        knockout);
        }
		
    } 
}